#!/bin/sh
[ ! -s $HOME/.jwm/corners/righttop ] && exit
set -a

start (){
	#delay to see if user really wants to activate corner app
	sleep 0.4
	#find height of screen
	WIDTH=`xwininfo -root | grep -m 1 '\geometry' | cut -f4 -d ' ' | cut -f1 -d 'x' | cut -f1 -d '+'`
	MAX_X=$((WIDTH-10))
	#get mouseposition
	[ `getcurpos | cut -d' ' -f2` -gt 10 ] && exit
	[ `getcurpos | cut -d' ' -f1` -lt $MAX_X ] && exit
	#execute user-defined command
	$HOME/.jwm/corners/righttop
}

export Corner_RightTop='
<window width-request="2" height-request="2">
 <text><label>""</label></text>
 <action signal="enter-notify-event">start</action>
</window>'
gtkdialog -p Corner_RightTop --name=cornerrighttop
